package validate;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import toolkit.Debug;

public class DateNotInPastValidator extends AbstractValidator
{
	@Override
	public boolean validate(String input)
	{
		if (input == null || input.isEmpty())
		{
			return false;
		}
		
		SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
		
		boolean inPast;
		
		try
		{
			inPast = sdf.parse(input).before(new Date());
			
			return !inPast;
		}
		catch (ParseException e)
		{
			Debug.log(e);
		}
		
		return false;
	}
	
	@Override
	public String getErrorMessage()
	{
		return "De ingevulde datum is in het verleden.";
	}
}
